// // 引入fs模块
const http = require('http');

// 启动服务
let msg = '';
let time = new Date();
msg = `${time.getFullYear()}-${time.getMonth()*1+1}-${time.getUTCDate()}`
console.log(msg);
let app = http.createServer((req, res) => {
    // req就是请求 requset  res 响应  response
    // 设置请求头
    res.setHeader('Content-Type', 'text/plain charset=utf-8');
    res.end(msg)
})

// port 端口号 数字类型
const port = 8888;
app.listen(port, ()=>{
    // 启动成功的回调
    console.log(`启动成功，请查看${port}端口！`);
})